package com.montran.search;

import java.util.Iterator;
import java.util.Vector;

import com.exceptions.FilterException;

public class SearchChain {
	// filter chain
	private Vector<Search> myFilters = new Vector<Search>();

	// Creates new FilterChain
	public SearchChain() {
	}

	public Boolean processSearch() throws FilterException {
		Search filter;

		// apply filters
		Iterator<Search> filters = myFilters.iterator();
		while (filters.hasNext()) {
			filter = (Search) filters.next();
			if (!filter.find()){
				return false;
			}
		}
		return true;
	}

	public void addFilter(Search filter) {
		myFilters.add(filter);
	}
}
